<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sinox="http://www.sinosoft.com.cn/sinox"
	xmlns:p="http://primefaces.org/ui">
	
	<ui:param name="compId" value="#{commonContentViewBean.id}" />
	<ui:param name="parentViewBean" value="#{commonContentViewBean.parent}" />
	
	<h:form id="#{compId}_form" style="margin:10px;">
	<p:fieldset id="#{compId}_base_fieldset" legend="事件基本信息"
		toggleable="true" toggleSpeed="500"
		style="text-align: center;">
		<ui:decorate template="/layout/input/editable-template.xhtml">
			<!-- 第一行 -->
			<ui:decorate template="/layout/input/editable-2c-custom-template.xhtml">
				<ui:param name="compBean1Id" value="event" />
				<ui:param name="compBean1Lable" value="事件触发类别" />
				
				<ui:define name="compBean1Content">
					<sinox:selectOneRadio id="#{compBean1Id}" value="#{commonContentViewBean.event}"
						items="#{bpmSelectItemsService.items.eventType}" />
				</ui:define>
				
				<ui:param name="compBean2Id" value="continueType" />
				<ui:param name="compBean2Lable" value="执行方式" />
				
				<ui:define name="compBean2Content">
					<sinox:selectOneRadio id="#{compBean2Id}" value="#{commonContentViewBean.continueType}"
						items="#{bpmSelectItemsService.items.continue}" />
				</ui:define>
			</ui:decorate>
			
			<!-- 第二行 -->
			<ui:decorate template="/layout/input/editable-2c-custom-template.xhtml">
				<ui:param name="compBean1Id" value="duedate" />
				<ui:param name="compBean1Lable" value="首次触发时间" />
				
				<ui:define name="compBean1Content">
					 <h:inputText id="#{compBean1Id}" value="#{commonContentViewBean.timer.duedate}" />
				</ui:define>
				
				<ui:param name="compBean2Id" value="repeat" />
				<ui:param name="compBean2Lable" value="重复触发间隔" />
				
				<ui:define name="compBean2Content">
					 <h:inputText id="#{compBean2Id}" value="#{commonContentViewBean.timer.repeat}" />
				</ui:define>
			</ui:decorate>
		</ui:decorate>
	</p:fieldset>
	
	<p:tabView activeIndex="0" effect="opacity" effectDuration="normal" style="margin:10px 2px 2px;">
		<c:forEach items="#{commonContentViewBean.events}" var="evt" varStatus="evt_stat">
			<p:tab title="事件#{evt_stat.index+1}" closable="#{evt.close}" style="margin:0;padding:0;border:0;">
				<h:panelGroup id="eventObject_#{evt_stat.index}" style="margin:0;" layout="block">
				<ui:param name="eventObject" value="#{evt}" />
				<ui:param name="eventObjectIndex" value="#{evt_stat.index}" />
				<ui:include src="/service/bpm/event/part/#{evt.type}.xhtml" />
				<p:remoteCommand name="#{commonContentViewBean.id}_eventObject_#{evt_stat.index}_change" 
					actionListener="#{bpmAction.changeEventAction}"
					update="eventObject_#{evt_stat.index}" />
				</h:panelGroup>
			</p:tab>
		</c:forEach>
	</p:tabView>
	
	<p:separator />
	
	<center>
		<h:panelGrid id="#{compId}_control" columns="4" style="text-align:center;" cellspacing="2px">
			<ui:param name="parentViewBeanId" value="#{parentViewBean.id}" />
			<p:commandButton title="保存" value="保存"
				actionListener="#{bpmAction.addDefineActivityEventAction}"
				update="#{parentViewBean.id}_form:eventsTable"
				oncomplete="#{compId}_dialog.hide();">
				<h:inputHidden value="#{compId}" />
			</p:commandButton>
			<p:commandButton title="关闭" value="关闭" type="button"
				onclick="#{compId}_dialog.hide();" />
		</h:panelGrid>
	</center>
	
	</h:form>
</ui:composition>